using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;

namespace TestKML
{
    class Program
    {
        static void Main(string[] args)
        {
            ////Use a MemoryStream Example
            //KML.KMLDocument kDoc = KML.KMLDocument.ReadFromFile(@"TestExtendedData.kml");
            
            //MemoryStream ms = new MemoryStream();
            //kDoc.Write(ms);
            //kDoc.WriteToFile(@"C:\KML\BLEH.kml");
            
            
            
            ////Create a KML File with 
            //KML.Document doc = new KML.Document("My Test");
            //KML.Point pt = new KML.Point(new KML.Coordinate(10, 10));
            //KML.Placemark pm = new KML.Placemark(pt);
            //pm.Name = "Garbage";
            //pm.Snippet = new KML.Snippet("Snippet Stuffs");
            //pm.Description = "Description Stuffs";
            //doc.Features.Add(pm);

            //KML.KMLDocument kDoc = new KML.KMLDocument();
            //kDoc.Feature = doc;
            //kDoc.WriteToFile(@"C:\DavidsStuff\KML\Test.kml");


            //Download a file from a location example
            HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://code.google.com/apis/kml/documentation/KML_Samples.kml");
            HttpWebResponse ws = (HttpWebResponse)wr.GetResponse();
            Stream str = ws.GetResponseStream();
            KML.KMLDocument kDoc = KML.KMLDocument.Read(str);
            str.Close();
            kDoc.WriteToFile(@"C:\Downloads\NewTest.kml");

        }
    }
}
